<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>档案登录</title>
<script src="libs/jquery-1.12.1.min.js"></script>
<script src="libs/jquery.backstretch.min.js"></script>
<script src="libs/css/layer.css"></script>
<script src="libs/css/layer.ext.css"></script>
<script src="libs/layer.ext.js"></script>
<script src="libs/layer.js"></script>
<script type="text/javascript" src="libs/md5.min.js"></script>
</head>
<body>
<div class="container">
	<div class="">
		<div class="">
			<div class="form-group" class="panel panel-springgreen">
				<label for="account" style="color: white" >账号</label>
				<input type="text" class="form-control" id="account">
			</div>
			<div class="form-group" >
				<label for="password" style="color: white">密码</label>
				<input type="text" class="form-control" id="password" >			
			</div>
			<button id="loginbut" class="btn" >登录</button>
		</div>
	</div>
</div>
<script type="text/javascript">
$.backstretch("picture/yes.jpg")
</script>

<script type="text/javascript">
$(function() {
	$('#loginbut').click(function() { 
		$.ajax({
	        async: true,     //异步
	        data: {
	          account: $('#account').val(),
	          password: md5($('#password').val())
	        },
	        dataType: 'text', // json
	        error: function (req, error) {       //回调函数
	          if ('timeout' == error) {
	            layer.msg('请求超时');
	          }
	        },
	        success: function (res) {            
	          if ('islogin' == res) {
	            layer.msg('登录成功');
	            window.location.href = 'homepage.html';
	          } else if ('nologin' == res) {
	            layer.msg('账号或密码错误');
	          }
	        },
	        timeout: 10000,
	        type: 'POST',
	        url: 'login.action'
		});	
	});
});
</script>

</body>
</html>